<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
String htmlData = request.getParameter("content1") != null ? request.getParameter("content1") : "";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta charset="utf-8" />
    
    <title>KindEditor JSP</title>
	<link rel="stylesheet" href="../../../kindeditor/themes/default/default.css" />
	<link rel="stylesheet" href="../../../kindeditor/plugins/code/prettify.css" />
	<script charset="utf-8" src="../../../kindeditor/kindeditor.js"></script>
	<script charset="utf-8" src="../../../kindeditor/lang/zh_CN.js"></script>
	<script charset="utf-8" src="../../../kindeditor/plugins/code/prettify.js"></script>
	<script>
		KindEditor.ready(function(K) {
			var editor1 = K.create('textarea[name="content1"]', {
				cssPath : '../../../kindeditor/plugins/code/prettify.css',
				uploadJson : '../../../kindeditor/jsp/upload_json.jsp',
				fileManagerJson : '../../../kindeditor/jsp/file_manager_json.jsp',
				allowFileManager : true,
				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						document.forms['example'].submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						document.forms['example'].submit();
					});
				}
			});
			prettyPrint();
		});
	</script>

  </head>
  
  <body>
   <%=htmlData%>
	
		<textarea name="content1" cols="100" rows="8" style="width:700px;height:200px;visibility:hidden;"><%=htmlspecialchars(htmlData)%></textarea>
		<br />
		
	
  </body>
</html>
<%!
private String htmlspecialchars(String str) {
	str = str.replaceAll("&", "&amp;");
	str = str.replaceAll("<", "&lt;");
	str = str.replaceAll(">", "&gt;");
	str = str.replaceAll("\"", "&quot;");
	return str;
}
%>
